@extends('admin.common.base-master')

@section('html-head')

@endsection

@section('html-body')
    <div id="content">
        <!-- cur-position start -->
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            <a href="#">商品管理</a>
        </div>

        <div class="filter-box clearfix">
            <div class="fr">
                <a class="addBtn" href="{{route('Admin.Page.addGoods')}}">新增</a>
            </div>
        </div>

        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>图片</th>
                    <th>商品名称</th>
                    <th>商品型号</th>
                    <th>商品属性</th>
                    <th>单价</th>
                    <th>购买类型</th>
                    <th>库存</th>
                    <th>销售量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @if(count($goods) > 0)
                    @foreach($goods as $good)
                        <tr id="good_{{$good->id}}">
                            <td>{{$good->id}}</td>
                            <td class="account-td" style="width: 5%;">
                                <span class="photo" style="border-radius: 100%;display:initial">
                                    <img src="{{route('Api.Image.Show',['id'=>$good->thumb_id])}}" alt="">
                                </span>
                            </td>
                            <td>{{$good->name}}</td>
                            <td>{{$good->model}}</td>
                            <td>
                                @if(count($good->goods_attrs) > 0)
                                    @foreach($good->goods_attrs as $attr)
                                        <p>{{$attr->name}}</p>
                                    @endforeach
                                @endif
                            </td>
                            <td>@if($good->type == 1){{$good->coin}}波罗币 @else{{$good->amount}}元 @endif</td>
                            <td>@if($good->type == 1)波罗币兑换 @else 微信支付购买 @endif</td>
                            <td>{{$good->stock}}</td>
                            <td>{{$good->sale_count}}</td>
                            <td>
                                <a href="{{route('Admin.Page.addGoods')}}?id={{$good->id}}" class="close"><span style="color: #515454">编辑</span></a> | <span style="color: #961212">删除</span></a>
                            </td>
                        </tr>
                    @endforeach
                @endif
                </tbody>
                <tfoot class="order-gl">

                </tfoot>
            </table>
            <!--            --><?php //echo $user->appends([])->render(); ?>
            <?php echo $goods->render(); ?>
        </div>
    </div>
    <script>
        $(function () {

        });
    </script>
@endsection